package com.dai.consumer_feign31.controller;

import com.dai.com_api.entity.Dept;
import com.dai.consumer_feign31.feign.DeptFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import java.util.List;


@RestController
public class DeptController_Consumer {
    @Autowired
    private DeptFeign deptFeign;

    @RequestMapping("/dept/add")
    public boolean add(@RequestBody Dept dept){
        return deptFeign.add(dept);
    }

    @RequestMapping(value = "/dept/get/{id}",method = RequestMethod.GET)
    public Dept get(@PathVariable("id") int id){
        return deptFeign.get(id);
    }

    @RequestMapping("/dept/list")
    public List<Dept> list(){
        return deptFeign.list();
    }
}
